<?php
class indexAction extends frontAction{
	public function execute(){
		$cateID = $this->getGetParam('cateID',0);
		$newsDao = new DaoNews();
		$categoryDao = new DaoCategory();
		$cate = $categoryDao->getOne("id='$cateID'");
		if($cate['id'] == 2||$cate['parentID']==2||$cate['id']==11){
			if($cate['id']==2){
				$cate = $categoryDao->getOne("parentID='2'");
			}

			$news = $newsDao->getOne(" categoryID = ".$cate['id']." order by sortID");

			forward('news/detail?id='.$news['id']);
			exit;
		}
		if(service_category::hasChildren($cateID)){
			$cates = service_category::getChildren($cateID);
			$ids = "";
			foreach($cates as $cate){
				$ids .= $cate['id'].",";
			}
			list($news,$page) = $newsDao->getListPage(" categoryID in(".trim($ids,',').") order by updateTime desc",20);
		}else{
			list($news,$page) = $newsDao->getListPage(" categoryID = ".$cateID." order by updateTime desc",20);
		}
		$currentID = service_menu::getCurrent(service_type::NEWS,$cateID);
		$cache = new Cache_request();
		$cache->set("currentID",$currentID);
		
		$this->assign('cate',$cate);
		$this->assign("news",$news);
		$this->assign("page",$page);
	}
}
?>
